﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web.Http;
using ServeNHL.Models;



namespace ServeNHL.Controllers
{
   
    public class SearchController : ApiController
    {
        [HttpGet]
        // GET api/<controller> for the search people page
        public List<UserViewModel> searchUsers(string name)
        {
            var userObj = new UserViewModel();
            var users = new List<UserViewModel>();

            users = userObj.findUsers(name);

            return users;
        }

        [HttpGet]
        // GET api/<controller> for the search events page
        public List<eventViewModel> searchEvent(string eventNameOnly)
        {
            var events = new List<eventViewModel>();
           // var events1 = new List<EVENT>();
            var eventitem = new eventViewModel();
          
           
            events = eventitem.getEventsVM(eventNameOnly);
            return events;
        }
      
        /*
        // GET api/<controller> for the search events page
        public List<eventViewModel> searchUserEvents(int id)
        {
            var events = new List<eventViewModel>();
            var eventitem = new eventViewModel();

            events = eventitem.userEvents(id);

            return events;
        }*/


        // GET api/<controller> for the search events page
        [HttpGet]
        public List<eventViewModel> searchEventsAll(string eventName, DateTime fromDate, DateTime toDate)
        {
            var events = new List<eventViewModel>();
            var eventitem = new eventViewModel();

            events = eventitem.getEvent(eventName, fromDate, toDate);

            return events;
        }

        // GET api/<controller> for the search events page
        [HttpGet]
        public List<eventViewModel> searchEvents(DateTime fromDate1, DateTime toDate1)
        {
            //var events = new List<eventViewModel>();
            var events = new List<eventViewModel>();
            var eventitem = new eventViewModel();

            events = eventitem.getEvents(fromDate1, toDate1);
            return events;
        }
    }
}